// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1
import "../delegates"
import "../models"

ListView {
    id: weekJobs

    signal addJob()
    property int fromTime: currentIndex >= 0 ? currentItem.seconds + 60*60*8 : 0

    width: 100
    height: 100
    orientation: ListView.Horizontal
    property int calcWidth: weekJobs.width/8 < 40 ? 40 : views.weekJobs/8

    model: weekJobModel
    delegate: DayOfWeekElement {
        width: weekJobs.calcWidth
        height: weekJobs.height
    }

    highlight: Rectangle {
        width: weekJobs.calcWidth;
        height: weekJobs.height;
        color: "lightsteelblue";
        radius: 5
    }
    highlightMoveDuration: 200

    MouseArea {
        anchors.fill: parent
        onClicked: {
            parent.currentIndex = parent.indexAt(mouseX, mouseY)
            parent.focus=true
        }
        onDoubleClicked: {
            addJob()
        }
    }
}
